<template>
  <div class="analysis-container">
    <div class="drug-item">
      <h2>{{ info.name }}</h2>
    </div>
    <div class="drug-item drug-type">{{ info.type }}</div>
    <div class="drug-item drug-type">
      <h3>成分：</h3><br/>{{ info.chengf }}
    </div>
    <div class="drug-item drug-type">
      <h3>用法用量：</h3><br/>{{ info.yongfa }}
    </div>
    <div class="drug-item drug-type">
      <h3>禁忌：</h3><br/>{{ info.jingj }}
    </div>
  </div>
</template>
  
<script>
export default {
  data() {
    return {
      title: '配伍禁忌',
      info: {}
    };
  },
  created() {


  },
  mounted() {
    const id = this.$route.query.id;

    // 根据需要对这些ID进行处理，例如发送请求获取相关数据
    if (id) {
      fetch(`https://i.iiiii5.cn//api/medicine/detail?server=1&id=${id}`)
        .then(response => response.json())
        .then(res => {
          this.info = res.data;
          // this.title = res.title + '的' + '配伍禁忌'
          console.log(res); // 处理返回的数据
        })
        .catch(error => console.error('Error:', error));
    }
  }
};
</script>
  
<style scoped>
.analysis-container {
  padding: 20px;
}

.drug-item {
  margin-bottom: 1rem;
}</style>
  